package com.lovo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.dao.UserDao;
import com.lovo.po.User;
import com.lovo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;


    @Override
    public User login(String userName, String userPwd) {
        QueryWrapper<User> qw =new QueryWrapper<>();
        qw.eq("user_name",userName).eq("user_pwd",userPwd).eq("permission_pid",0);

        User user = userDao.selectUserByWrapper(qw);

        return user;

    }

    @Override
    public User getUserPermission(Integer userId) {
        QueryWrapper<User> qw =new QueryWrapper<>();
        qw.eq("user_id",userId).eq("permission_pid",0);
        User user =userDao.selectUserByWrapper(qw);
        return user;
    }
}
